home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
cc01.arc
/
ARCRIGHT.C
< prev
next >
Wrap
Text File
|
1986-03-14
|
4KB
|
251 lines
/*
NetWare Local Archive Utility
V4.41 01/31/84 by Mark Hurst
For use with NetWare V4.n systems
Copyright (C) 1983, 1984 Novell, Inc.
*/
#include "ctype.h"
#include "stdio.h"
#define LOCALBIT 0x80
#define PERMNET 0x01
#define TEMPNET 0x02
#define NETBITS 0x03
#define READBIT 0x01
#define WRITEBIT 0x02
#define OPENBIT 0x04
#define CREATEBIT 0x08
#define DELETEBIT 0x10
#define OWNEDBIT 0x20
#define SEARCHBIT 0x40
#define MODIFYBIT 0x80
/* NOTE: the Archive bit was 0x80 on ShareNet V3.12. Has now changed: */
#define BACKUPBIT 0x20
#define VARPATH '^' - 'A'
#define TRUE 1
#define FALSE 0
extern FILE *log;
extern int source, target; /* low level I/O file numbers */
char *calloc(), *malloc();
typedef struct dosfcb {
char drive;
char fname[8];
char fext[3];
unsigned curblk;
unsigned recsize;
long size;
unsigned date;
char reserved[10];
char relrec;
char record[4];
} FCB;
typedef struct exdirfcb {
char dummy;
char exset;
char res[5];
char flags;
char drive;
char fname[8];
char fext[3];
char gap[17];
char size[4];
} ExDirFCB;
typedef struct exdosfcb {
char dummy;
char exset;
char res[5];
char flags;
char drive;
char fname[8];
char fext[3];
unsigned curblk;
unsigned recsize;
long size;
unsigned date;
char reserved[10];
char relrec;
char record[4];
} ExFCB;
extern int listcount;
typedef struct liststruct {
struct liststruct *link;
char name[12]; /* 1 too big for even allocation */
char marked;
char flags;
long size; /* size of file in bytes */
unsigned units; /* size of file in allocation units */
} LISTNODE;
#define LISTSIZE 250
extern LISTNODE *list[LISTSIZE], *curnode;
extern ExFCB sourcefile;
extern ExFCB destfile;
int imin();
unsigned umin();
long lmin();
/*--------*/
typedef struct getsubstruct {
int length;
char function;
char handle;
int sequence; /* HIGH-LOW */
char speclength;
} GETSUB;
typedef struct retsubstruct {
int length;
char name[16];
char createdate[2];
char createtime[2];
long creator;
char rights;
char padbyte;
int dirnumber; /* HIGH-LOW */
} RETSUB;
int DirRights (drive, rights)
char drive, *rights;
{
GETSUB get;
RETSUB ret;
char type;
int ccode;
get.length = 5;
get.function = 2;
get.handle = GetHandle (drive, &type);
get.sequence = 0x100; /* 1 in high-low order */
get.speclength = 0;
ret.length = sizeof (RETSUB) - 2;
ccode = dirpath (&get, &ret);
*rights = ret.rights;
return (ccode);
}
typedef struct gettrust {
int length;
char function;
char handle;
char setnumber;
char speclength;
} GETTRUST;
typedef struct rettrust {
int length;
char dirname [16];
char createtime [4];
long creator;
long trustee [5];
char mask [5];
} RETTRUST;
ScanTrustees (drive, proc)
char drive;
int (*proc)();
{
GETTRUST get;
RETTRUST ret;
char type;
int ccode, i;
get.length = 4;
get.function = 12;
get.handle = GetHandle (drive, &type);
get.setnumber = 1;
get.speclength = 0;
ret.length = sizeof (RETTRUST) - 2;
while (dirpath (&get, &ret) == 0) {
for (i = 0; i < 5; i++) {
if (ret.trustee [i] != (long) 0)
(*proc) (ret.trustee [i], ret.mask [i]);
}
get.setnumber ++;
}
}
static int TCount;
AddTrustFile ()
{
int TC;
curnode = (LISTNODE *) calloc (1, sizeof (LISTNODE));
list [listcount ++] = curnode;
curnode->name[0] = 0x80;
curnode->marked = 0;
curnode->flags = 0;
curnode->size = 1000000L; /* dummy size anyway */
curnode->units = 0;
}
static char *tptr, *tcptr;
TCopy (Trustee, Rights)
long Trustee;
char Rights;
{
TCount ++;
movmem (&Trustee, tptr, 4);
tptr += 4;
*tptr ++ = Rights;
}
/* Return 0 if fail to write out trustee rights file, TRUE if OK */
CopyTrustees (buffer)
char *buffer;
{
int actual;
char drights;
TCount = 0;
tptr = buffer;
*tptr ++ = 0xFF; /* first byte indicates that stuff is saved in header*/
tcptr = tptr;
tptr += 2;
if (DirRights (VARPATH, &drights)) *tptr ++ = 0xFF; /* default ALL */
else *tptr ++ = drights;
ScanTrustees (VARPATH, TCopy);
/* COPY TRUSTEE COUNT */
tptr = &TCount;
*tcptr ++ = *tptr ++;
*tcptr = *tptr;
}